public class Principal {

    public static void main(String[] args) {
        int numInput = 30;
        int result = numInput;

        for (int i = 2; i <= numInput; i++) {
            if (result % i == 0) {
                result = result / i;
                System.out.println(i);
            }
        }
    }
}
